package com.kfm.ajax.model;

import com.kfm.ajax.model.valid.LoginGroup;
import com.kfm.ajax.model.valid.UserEditGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName user
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserModel implements Serializable {
    /**
     * 用户编号, 自定义
     */
    private String id;

    /**
     * 用户名
     */
    @NotEmpty(message = "用户名不能为空", groups = {LoginGroup.class, UserEditGroup.class})
    @Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9]{4,19}$", message = "用户名必须是5-20位以字母开头的字母数字组合", groups = {LoginGroup.class, UserEditGroup.class})
    private String username;

    /**
     * 密码(需要加密)
     */
    @NotEmpty(message = "密码不能为空", groups = {LoginGroup.class})
    @Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9]{5,19}$", message = "密码必须是6-20位以字母开头的字母数字组合", groups = {LoginGroup.class})
    private String password;

    /**
     * 真实姓名
     */
    @NotEmpty(message = "真实姓名不能为空", groups = {UserEditGroup.class})
    private String name;

    /**
     * 手机号
     */
    @NotEmpty(message = "手机号不能为空", groups = {UserEditGroup.class})
    private String phone;

    /**
     * 邮箱
     */
    @NotEmpty(message = "邮箱不能为空", groups = {UserEditGroup.class})
    private String email;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 状态 0 禁用 1正常
     */
    private Integer state;

    /**
     * 创建时间
     */
    private Date createDate;

    /**
     * 更新时间
     */
    private Date updateDate;

    /**
     * 部门编号
     */
    private Integer deptId;


}